import yaml
from baseTools.myLogger import main_path

def my_read_yaml(file, key_word=None):
    with open(file, encoding='utf-8') as f:
        values = yaml.safe_load(f)
        if key_word:
            new_values = []
            for value in values:
                if key_word == value.get('key_word'):
                    new_values.append(value)
            return new_values
        else:
            return values

# # print(my_read_yaml(r'C:\TT\习知\12\接口测试框架封装\case_data\org_test_data.yaml'))
# print(main_path+r'\case_data\org_test_data.yaml')
# create_org_datas = my_read_yaml(r'C:\TT\习知\12\接口测试框架封装\case_data\org_test_data.yaml', key_word='org_create')
# print(create_org_datas)